<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        padding: 0;
        margin: 0;
      }
      @media screen and (min-width: 640px) {
        html {
          font-size: 50px;
        }
      }
      @media screen and (min-width: 960px) {
        html {
          font-size: 100px;
        }
      }
      div {
        height: 1rem;
        font-size: 0.5rem;
        background-color: green;
        color: #fff;
        text-align: center;
        line-height: 1rem;
      }
      p {
        color: #000;
        font-size: 0.5em;
      }
    </style>
  </head>
  <body>
    <div>
      <span> rem是一个相对单位，是相对于html元素字体大小来说的。</span>
      <p>不同于em，em是相对于其父元素的字体大小。</p>
    </div>
  </body>
</html>
